<?php namespace App\Controllers;

use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Config\Config;
use CodeIgniter\HTTP\CURLRequest;

class Other extends BaseController{
	use ResponseTrait;
	public function config(){
		//$conf=config('App');
		$conf=Config::get('App');
		return $this->respond($conf->baseURL);
	}
	public function redis(){
		$amr=new \App\Models\Redis();
		$amr->setToken('ci-key', 'jj');
		var_dump($amr->getToken('ci-key'));
		$amr->delToken('ci-key');
		var_dump($amr->getToken('ci-key'));
	}
	public function curl(){
		$options = [
			'base_uri' => 'http://example.com/api/v1/',
			'timeout'  => 3
		];
		$client = \Config\Services::curlrequest();//$options
		$result=$client->get('http://test.cuiwei.net/json.php', ['timeout' => 5])->getBody();
		return $this->respond(json_decode($result, true));
	}
}
